<?php
/* ::: BOX Class ::: */
/* Creates a box */

class box {
    private $size;      //Box size
    private $username;  //Username of the user controlling it
    private $userid;    //Userid of the user controlling it
    private $points;    //User points
    private $top;       //Top position
    private $left;      //Left position
    private $moveAtt;   //How much to move the box up and down in px
    private $sizeAtt;   //How much to down or upside the box when colide in px
    
    function __construct(array $args) {
        foreach($args as $att => $val) {
            if(is_null($this->$att)) {
                $this->$att = $val;
            }
        }
    }
    
    function moveLeft() {
        $left = $this->left - $this->moveAtt;
        $this->left = $left;
        return (int) $left;
    }
    
    function moveRight() {
        $right = $this->left + $this->moveAtt;
        $this->left = $right;
        return (int) $right;
    }
    
    function moveUp() {
        $up = $this->top - $this->moveAtt;
        $this->top = $up;
        return (int) $up;
    }
    
    function moveDown() {
        $down = $this->top - $this->moveAtt;
        $this->top = $down;
        return (int) $down;
    }
    
    function growDown() {
        $size = $this->size - $this->sizeAtt;
        $this->size = $size;
        return (int) $size;
    }
    
    function growUp() {
        
    }
}